<template>
  <FormView
    v-model="entity"
    :title="entity.id ? '修改土地管理' : '新建土地管理'"
    :toolbar-attrs="{ buttons: ['back', 'save', 'cancel'] }"
    :toolbar-listeners="{ save: persist }">
    <FormHolder ref="form" label-width="100px" :model="entity">
      <FormItemGroup block-title="基本信息">
        <FormInput v-model="entity.assetName" prop="assetName" label="资产名称" max-length="255" required />
        <FormInput v-model="entity.assetNumber" prop="assetNumber" label="资产编号" max-length="255" disabled />
        <FormDatePicker v-model="entity.registrationDate" label="登记日期" prop="registrationDate" required />
        <FormSelect v-model="entity.status" dict-type="room_land_status" label="使用状况" required />
        <FormInput v-model="entity.landNumber" prop="landNumber" label="土地编号" max-length="255" required />
        <FormInput v-model="entity.location" prop="location" label="坐落位置" max-length="255" />
        <FormInput v-model="entity.usufructType" prop="usufructType" label="使用权类型" max-length="255" />
        <FormInput v-model="entity.acquireWay" prop="acquireWay" label="取得方式" max-length="50" />
        <FormInput v-model="entity.permittedUse" prop="permittedUse" label="批准用途" max-length="50" />
        <FormInput v-model="entity.practicalUse" prop="practicalUse" label="实际用途" max-length="50" />
        <FormInputNumber v-model="entity.usefulLife" prop="usefulLife" label="使用年限" :min="0" :max="9999" />
        <FormDatePicker v-model="entity.builddate" label="取得日期" prop="builddate" required />
        <FormInput v-model="entity.ownershipType" prop="ownershipType" label="权属性质" max-length="50" />
        <FormInput v-model="entity.ownershipProve" prop="ownershipProve" label="权属证明" max-length="50" />
        <FormInput v-model="entity.ownershipNumber" prop="ownershipNumber" label="权属证号" max-length="50" />
        <FormInput v-model="entity.propertyType" prop="propertyType" label="产权形式" max-length="50" />
        <FormInputNumber
          v-model="entity.overallFloorage"
          prop="overallFloorage"
          label="总面积"
          :min="0"
          :max="999999999">
          <template #append><slot name="append">平米</slot></template>
        </FormInputNumber>
        <FormInputNumber v-model="entity.ownershipArea" prop="ownershipArea" label="权属面积" :min="0" :max="999999999">
          <template #append><slot name="append">平米</slot></template>
        </FormInputNumber>
        <FormInputNumber v-model="entity.landPrice" prop="landPrice" label="基本地价" :min="0" :max="999999999">
          <template #append><slot name="append">万元</slot></template>
        </FormInputNumber>
        <FormDatePicker v-model="entity.issueDate" label="发证日期" prop="issueDate" required />
        <FormInput v-model="entity.landusagePermit" prop="landusagePermit" label="使用证号" />
        <FormInput v-model="entity.x" prop="x" label="经度" max-length="15" />
        <FormInput v-model="entity.y" prop="y" label="纬度" max-length="15" />
        <FormTextarea v-model="entity.remarks" rows="5" prop="remarks" label="备注" max-length="3000" />
      </FormItemGroup>
    </FormHolder>
  </FormView>
</template>

<script>
  import { addObj, putObj, getObj } from '@/api/space/fyroomland'
  import form from '@/vue/mixin/form'

  export default {
    name: 'RoomLandForm',
    relativeViewId: 'RoomLandView',
    mixins: [form],
    data() {
      return {
        entity: {
          acquireWay: '',
          assetName: '',
          assetNumber: '',
          builddate: null,
          createBy: '',
          createId: null,
          createTime: '',
          deptFullname: '',
          deptId: null,
          id: '',
          issueDate: null,
          landNumber: '',
          landPrice: '',
          landusagePermit: '',
          location: '',
          overallFloorage: '',
          ownershipArea: '',
          ownershipNumber: '',
          ownershipProve: '',
          ownershipType: '',
          permittedUse: '',
          practicalUse: '',
          propertyType: '',
          registrationDate: null,
          remarks: '',
          status: '',
          updateBy: '',
          updateTime: '',
          usefulLife: '',
          usufructType: '',
          x: '',
          y: ''
        }
      }
    },
    methods: {
      load: getObj,
      save: addObj,
      update: putObj
    }
  }
</script>
